/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package obj;

import java.util.Date;
import org.json.me.JSONException;
import org.json.me.JSONObject;

/**
 *
 * @author lenovo
 */
public class NguoiDung {
    String PK_sNguoidungID;
    String sHoten;
    String dNamsinh;
    String sDiachi;
    String sSodienthoai;
    String sEmail;
    int iTrangthai;
    String sMatkhau;

    public String getPK_sNguoidungID() {
        return PK_sNguoidungID;
    }

    public String getdNamsinh() {
        return dNamsinh;
    }

    public int getiTrangthai() {
        return iTrangthai;
    }

    public String getsDiachi() {
        return sDiachi;
    }

    public String getsEmail() {
        return sEmail;
    }

    public String getsHoten() {
        return sHoten;
    }

    public String getsMatkhau() {
        return sMatkhau;
    }

    public String getsSodienthoai() {
        return sSodienthoai;
    }

    public void setPK_sNguoidungID(String PK_sNguoidungID) {
        this.PK_sNguoidungID = PK_sNguoidungID;
    }

    public void setdNamsinh(String dNamsinh) {
        this.dNamsinh = dNamsinh;
    }

    public void setiTrangthai(int iTrangthai) {
        this.iTrangthai = iTrangthai;
    }

    public void setsDiachi(String sDiachi) {
        this.sDiachi = sDiachi;
    }

    public void setsEmail(String sEmail) {
        this.sEmail = sEmail;
    }

    public void setsHoten(String sHoten) {
        this.sHoten = sHoten;
    }

    public void setsMatkhau(String sMatkhau) {
        this.sMatkhau = sMatkhau;
    }

    public void setsSodienthoai(String sSodienthoai) {
        this.sSodienthoai = sSodienthoai;
    }

    public NguoiDung() {
    }

    public NguoiDung(String PK_sNguoidungID, String sHoten, String dNamsinh, String sDiachi, String sSodienthoai, String sEmail, int iTrangthai, String sMatkhau) {
        this.PK_sNguoidungID = PK_sNguoidungID;
        this.sHoten = sHoten;
        this.dNamsinh = dNamsinh;
        this.sDiachi = sDiachi;
        this.sSodienthoai = sSodienthoai;
        this.sEmail = sEmail;
        this.iTrangthai = iTrangthai;
        this.sMatkhau = sMatkhau;
    }
    
    public void fromJSON(String jsonString) {
		try {
			JSONObject json = new JSONObject(jsonString);
                        setPK_sNguoidungID(json.getString("PK_sNguoidungID"));
                        setsHoten(json.getString("sHoten"));
                        setdNamsinh(json.getString("dNamsinh"));
                        setsDiachi(json.getString("sDiachi"));
                        setsSodienthoai(json.getString("sSodienthoai"));
                        setsEmail(json.getString("sEmail"));
                        setiTrangthai(json.getInt("iTrangthai"));
                        setsMatkhau(json.getString("sMatkhau"));
		} catch (JSONException ex) {
			ex.printStackTrace();
		}
	}
    public String toJSON() {
            JSONObject inner = new JSONObject();
            try {
                inner.put("PK_sNguoidungID", getPK_sNguoidungID());
                inner.put("sHoten", getsHoten());
                inner.put("dNamsinh", getdNamsinh());
                inner.put("sDiachi", getsDiachi());
                inner.put("sSodienthoai", getsSodienthoai());
                inner.put("sEmail", getsEmail());
                inner.put("iTrangthai", getiTrangthai());
                inner.put("sMatkhau", getsMatkhau());
            } catch (JSONException ex) {
                    ex.printStackTrace();
            }
            return inner.toString();
    }
}
